/*
 * @(#)xin.tianhui.cloud.weblog.core.thymeleaf.dialect
 * @(#)ColumnDialect.java	2018-04-05
 * 
 * Copyright © 2018-2027, All rights reserved.
 * homeanter
 */
package xin.tianhui.cloud.weblog.thymeleaf.dialect;

import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;

import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.processor.IProcessor;
import org.thymeleaf.standard.StandardDialect;
import org.thymeleaf.standard.processor.StandardXmlNsTagProcessor;
import org.thymeleaf.templatemode.TemplateMode;


/**
 * <P>Description: 自定义方言</P>
 * @author junchen homeanter@163.com  
 * @date 2018-04-05 18:46:47
 * @see TODO
 */
public class AppDialect extends AbstractProcessorDialect{
	
	private static final String NAME = "App";
	public static final String PREFIX = "app";
	
	private final Collection<IProcessor> processors;
	
    public AppDialect(Collection<IProcessor> processors) {
        super(NAME, PREFIX, StandardDialect.PROCESSOR_PRECEDENCE);
        this.processors = processors;
    }
    
	@Override
	public Set<IProcessor> getProcessors(String dialectPrefix) {
		LinkedHashSet<IProcessor> iProcessors = new LinkedHashSet<IProcessor>();
		iProcessors.add(new StandardXmlNsTagProcessor(TemplateMode.HTML, dialectPrefix));
		iProcessors.addAll(processors);
		return iProcessors;
	}
}
